package unit5.part13;

public class Proxy {
    public static void main(String[] args) {
        VPN vpn = new VPN();
        vpn.setWeb(new Youtube());
        vpn.processRequest();
    }
}

interface Web {// Web网站
    void processRequest();
}

class Youtube implements Web {// Youtube
    @Override
    public void processRequest() {
        System.out.println("访问Youtube");
    }

}

class VPN implements Web {// VPN
    private Web web;

    @Override
    public void processRequest() {
        System.out.println("登录VPN");
        System.out.println("校验权限");
        web.processRequest();
        System.out.println("退出VPN");
    }

    public void setWeb(Web web) {
        this.web = web;
    }
}

